<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');

class Db_backup extends MX_Controller {

	public function __construct() {
		parent::__construct();
		$this->load->model(array('admin_commoncall','admin_settings_model','admin_review_model','admin_news_model','admin_member_model','admin_location_model'));

		$this->admin_commoncall->check_admin_login();
		$this->template->set_theme('admin');
		$this->template->set_layout('default');
		//$this->template->set_partial('side_menu','layouts/side_menu');
		//$this->template->set_partial('nav_bar','layouts/nav_bar');

	}
	
	function backup()
	{
		
		//ini_set('memory_limit',"1024M");
		// Load the DB utility class
		$this->load->dbutil();
	
		// Backup your entire database and assign it to a variable
		$backup =& $this->dbutil->backup();
	
		// Load the file helper and write the file to your server
		$this->load->helper('file');
		write_file('/path/to/mybackup.gz', $backup);
	
		// Load the download helper and send the file to your desktop
		$this->load->helper('download');
		force_download('mybackup.gz', $backup);
	}
	
}